package com.lbs.jiepiaisi.style.citylist.utils;

import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.lbs.jiepiaisi.bean.ChinaCityBean;
import com.lbs.jiepiaisi.bean.CityEntity;
import com.lbs.jiepiaisi.bean.JvHeCityBean;
import com.lbs.jiepiaisi.style.citylist.bean.CityInfoBean;
import com.lbs.jiepiaisi.utils.Constant;
import com.lbs.jiepiaisi.utils.Utils;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * 作者：liji on 2017/5/21 15:35
 * 邮箱：lijiwork@sina.com
 * QQ ：275137657
 */

public class CityListLoader {
    
    public static final String BUNDATA = "bundata";
    
    private static List<CityInfoBean> mCityListData = new ArrayList<>();
    
    private static List<CityInfoBean> mProListData = new ArrayList<>();
    
    /**
     * 解析所有的城市数据 357个数据
     */
    public List<CityInfoBean> getCityListData() {
        return mCityListData;
    }
    
    /**
     * 只解析省份34个数据
     */
    public List<CityInfoBean> getProListData() {
        return mProListData;
    }
    
    private volatile static CityListLoader instance;
    
    private CityListLoader() {
        
    }
    
    /**
     * 单例模式
     * @return
     */
    public static CityListLoader getInstance() {
        if (instance == null) {
            synchronized (CityListLoader.class) {
                if (instance == null) {
                    instance = new CityListLoader();
                }
            }
        }
        return instance;
    }
    
    /**
     * 解析357个城市数据
     * @param context
     */
    public void loadCityData(Context context) {
        
        String cityJson = Utils.getJson(context, Constant.CITY_DATA);
        Type type = new TypeToken<ArrayList<CityInfoBean>>() {
        }.getType();
        
        //解析省份
        ArrayList<CityInfoBean> mProvinceBeanArrayList = new Gson().fromJson(cityJson, type);
        if (mProvinceBeanArrayList == null || mProvinceBeanArrayList.isEmpty()) {
            return;
        }
        
        for (int p = 0; p < mProvinceBeanArrayList.size(); p++) {
            
            //遍历每个省份
            CityInfoBean itemProvince = mProvinceBeanArrayList.get(p);
            
            //每个省份对应下面的市
            ArrayList<CityInfoBean> cityList = itemProvince.getCityList();
            
            //遍历当前省份下面城市的所有数据
            for (int j = 0; j < cityList.size(); j++) {
                mCityListData.add(cityList.get(j));
            }
        }
        
    }

    /**
     * 解析357个城市数据
     * @param context
     */
    public void loadCityDataFromJson2(Context context) {

        String cityJson = Utils.getJson(context, Constant.CITY_DATA2);
        Type type = new TypeToken<ArrayList<ChinaCityBean>>() {
        }.getType();

        //解析省份
        ArrayList<ChinaCityBean> chinaDataList = new Gson().fromJson(cityJson, type);
        if (chinaDataList == null || chinaDataList.isEmpty()) {
            return;
        }

//        for (int p = 0; p < chinaDataList.size(); p++) {
//            CityInfoBean cityInfoBean = new CityInfoBean();
//            cityInfoBean.setId(chinaDataList.get(p).id + "");
//            cityInfoBean.setName(chinaDataList.get(p).cityName);
//            cityInfoBean.setAbbr(chinaDataList.get(p).abbr);
//            cityInfoBean.setCityName(chinaDataList.get(p).cityName);
//            cityInfoBean.setCityCode(chinaDataList.get(p).cityCode);
//            cityInfoBean.setProvince(chinaDataList.get(p).province);
//            cityInfoBean.setProvinceCode(chinaDataList.get(p).provinceCode);
//            cityInfoBean.setEngine(chinaDataList.get(p).engine);
//            cityInfoBean.setEngineno(chinaDataList.get(p).engineno);
//            cityInfoBean.setClassa(chinaDataList.get(p).classa);
//            cityInfoBean.setClassno(chinaDataList.get(p).classno);
//            mCityListData.add(cityInfoBean);
//        }

    }

    /**
     * 从网络获取城市数据
     * @param context
     * @param letterToCity
     */
    public void loadCityDataFromNet(Context context, List<CityEntity.Result.Item> letterToCity) {

        //解析省份
        ArrayList<CityInfoBean> mProvinceBeanArrayList = new ArrayList<>();
        for(int i = 0; i<letterToCity.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            cityInfoBean.setId(letterToCity.get(i).getId() + "");
            cityInfoBean.setName(letterToCity.get(i).getCityName());
            mCityListData.add(cityInfoBean);
        }
    }
    
    /**
     * 解析34个省市直辖区数据
     * @param context
     */
    public void loadProData(Context context) {
        String cityJson = Utils.getJson(context, Constant.CITY_DATA);
        Type type = new TypeToken<ArrayList<CityInfoBean>>() {
        }.getType();
        
        //解析省份
        mProListData = new Gson().fromJson(cityJson, type);
    }

    /**
     * 从聚合接口获取城市列表
     * @param result
     */
    public void loadCityDataFromJson3(JvHeCityBean.ResultBean result) {
        Type type = new TypeToken<ArrayList<JvHeCityBean.ResultBean>>() {
        }.getType();

        //解析省份
        ArrayList<ChinaCityBean> chinaDataList = new ArrayList<>();
        //添加北京
        for(int i = 0; i < result.BJ.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(result.BJ.citys.get(i).city_name);
            cityInfoBean.setAbbr(result.BJ.citys.get(i).abbr);
            cityInfoBean.setCityName(result.BJ.citys.get(i).city_name);
            cityInfoBean.setCityCode(result.BJ.citys.get(i).city_code);
            cityInfoBean.setProvince(result.BJ.province);
            cityInfoBean.setProvinceCode(result.BJ.province_code);
            cityInfoBean.setEngine(result.BJ.citys.get(i).engine);
            cityInfoBean.setEngineno(result.BJ.citys.get(i).engineno);
            cityInfoBean.setClassa(result.BJ.citys.get(i).classa);
            cityInfoBean.setClassno(result.BJ.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }

        //设置上海市区
        setCityData(result.SH);
        //设置广东市区
        setCityData(result.GD);
        //
        setCityData(result.SC);
        setCityData(result.FB);
        setCityData(result.HAN);
        setCityData(result.ZJ);
        setCityData(result.FJ);
        setCityData(result.HB);
        setCityData(result.JL);
        setCityData(result.GZ);
        setCityData(result.XJ);
        setCityData(result.LN);
        setCityData(result.SD);
        setCityData(result.HN);
        setCityData(result.JS);
        setCityData(result.HUN);
        setCityData(result.SX);
        setCityData(result.QH);
        setCityData(result.AH);
        setCityData(result.CQ);
        setCityData(result.JX);
        setCityData(result.TJ);
    }

    //上海
    private void setCityData(JvHeCityBean.ResultBean.SHBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //广东
    private void setCityData(JvHeCityBean.ResultBean.GDBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.SCBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.FBBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.HANBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.ZJBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.FJBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.HBBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.JLBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.GZBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.XJBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.LNBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.SDBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.HNBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.JSBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.HUNBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.SXBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.QHBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.AHBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.CQBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.JXBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }
    //
    private void setCityData(JvHeCityBean.ResultBean.TJBean o) {

        for(int i = 0; i < o.citys.size(); i++){
            CityInfoBean cityInfoBean = new CityInfoBean();
            //cityInfoBean.setId(result.BJ.citys.get(i).+ "");
            cityInfoBean.setName(o.citys.get(i).city_name);
            cityInfoBean.setAbbr(o.citys.get(i).abbr);
            cityInfoBean.setCityName(o.citys.get(i).city_name);
            cityInfoBean.setCityCode(o.citys.get(i).city_code);
            cityInfoBean.setProvince(o.province);
            cityInfoBean.setProvinceCode(o.province_code);
            cityInfoBean.setEngine(o.citys.get(i).engine);
            cityInfoBean.setEngineno(o.citys.get(i).engineno);
            cityInfoBean.setClassa(o.citys.get(i).classa);
            cityInfoBean.setClassno(o.citys.get(i).classno);
            mCityListData.add(cityInfoBean);
        }
    }



}
